package com.example.demo.example1.controller;

import com.example.demo.example1.entity.Course;
import com.example.demo.example1.repository.CourseRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by pengwan on 2017/7/27.
 */
@RestController
public class testController {
    @Autowired
    private CourseRepository courseRepository;
    @RequestMapping(value = "/test")
    @ResponseBody
    Course getCourse(){
        return courseRepository.findOneByName("计算机原理");
    }
}
